import request from '@/utils/request'

const userApi = {
  DeleteById: '/picachoframework/user/deleteById',
  AddUser: '/picachoframework/user/addUser',
  UpdateUser: '/picachoframework/user/updateById',
  GetMapData: '/picachoframework/test/getMapData'
}

/**
 * 根据id删除用户
 * @param user
 * @returns {AxiosPromise}
 */
export function deleteById (user) {
  const temp = request({
    url: userApi.DeleteById,
    method: 'post',
    data: user
  })
  return temp
}

export function addUser (user) {
  return request({
    url: userApi.AddUser,
    method: 'post',
    data: user
  })
}

export function updateByUserId (user) {
  return request({
    url: userApi.UpdateUser,
    method: 'post',
    data: user
  })
}

export function getMapData () {
  return request({
    url: userApi.GetMapData,
    method: 'get',
    headers: {
      'Content-Type': 'application/json;charset=UTF-8'
    }
  })
}
